Repository navigation
fix(workbench): keep flexDirection column on display-toggled conversation and workspace surfaces - #7569
Conversation
…omations is closed In apache#7563 (d5d8cf4), SessionSurface wrapped Conversation and ComposerView in a View styled with `display: automationsOpen() ? 'none' : 'flex'` without setting `flexDirection: 'column'`. Because NSH switches a View to `FlexDirection::Row` whenever `display: 'flex'` is explicitly set without a direction, the composer was laid out horizontally to the top-right beside the conversation instead of stacked below it. Extract `conversationStageStyle` with explicit `flexDirection: 'column'` and add a headless NSH layout regression test covering both visible and hidden states. Generated-by: Antigravity
M4n5ter
left a comment
There was a problem hiding this comment.
English
Root cause is spot-on, and adding flexDirection: 'column' cleanly fixes the regression in SessionSurface.tsx. Two review comments:
-
Same
display: 'flex'bug in a peer component:WorkspaceSurfaceinproducts/maka/workbench/app/App.tsx
Auditing otherdisplay: ... 'flex'call sites across the repo,WorkspaceSurface(products/maka/workbench/app/App.tsx, around line 1708) also setsdisplay: props.visible() ? 'flex' : 'none'withoutflexDirection: 'column'. Two of its call sites render multiple direct children:- Conversations surface when
!shell.sidebarDocked():<Workbench>and the bottomAll computersaction bar are siblings insideWorkspaceSurface. - Rooms surface when a remote root is disconnected:
{modeSwitch()}and<MirrorBrowser />are siblings insideWorkspaceSurface.
In both cases NSH switches the container to
FlexDirection::Rowand lays those children out side-by-side. Worth addingflexDirection: 'column'toWorkspaceSurfacein the same fix so we don't leave the identical pitfall behind. - Conversations surface when
-
Avoid exporting an internal style helper just for a synthetic layout test
The actual fix is one line (flexDirection: 'column'), while exportingconversationStageStylefromSessionSurface.tsxexists solely soautomations_tests.rscan plug that 5-line style object into a hand-built<View>with two dummy child<View>s.- Because the test never mounts
SessionSurface(or<Conversation>/<ComposerView>), it wouldn't catch a real regression inSessionSurfaceitself (e.g., switching back to an inline style or adding another wrapper withoutflexDirection: 'column'). - Meanwhile, importing from
../../../plugins/agent/conversations/ui/SessionSurface.tsxmakesnsh-bundlerbundle the entire 3,700-lineSessionSurface.tsxmodule graph just to read a style literal.
Suggest keeping the style inline in
SessionSurface.tsx(just addingflexDirection: 'column'), dropping theconversationStageStyleexport and the synthetic test—or, if a regression test is warranted, asserting layout on an actually mountedSessionSurfacerather than an exported style object. - Because the test never mounts
简体中文
根因定位准确,补上 flexDirection: 'column' 能直接修掉 SessionSurface.tsx 的回归。有两点建议:
-
同类路径漏审:
products/maka/workbench/app/App.tsx中的WorkspaceSurface存在一模一样的坑
全仓排查了所有display: ... 'flex'用法,WorkspaceSurface(products/maka/workbench/app/App.tsx第 1708 行附近)同样写了display: props.visible() ? 'flex' : 'none'而未显式指定flexDirection: 'column'。它有两处调用方传了多个直接子节点:- 会话视图在
!shell.sidebarDocked()(窄窗未停靠侧边栏)时:<Workbench>和底部的「All computers」按钮条是兄弟节点; - Rooms 视图在远端 root 断开连接时:
{modeSwitch()}和<MirrorBrowser />是兄弟节点。
这两处都会触发 NSH 隐式切
FlexDirection::Row导致横排错位,建议这次顺手把WorkspaceSurface也补上flexDirection: 'column'。 - 会话视图在
-
不建议为了手搓假壳测试导出内部样式函数
实际修复只有flexDirection: 'column'这一行,从SessionSurface.tsx抽出并exportconversationStageStyle只是为了让automations_tests.rs把这个 5 行样式对象塞进两个写死的 dummy<View>里测:- 该测试并没有挂载真实的
SessionSurface(也没有<Conversation>/<ComposerView>),后续如果SessionSurface.tsx里改回内联 style 或多套一层漏写column的<View>,测试仍会通过,防不住真实回归; - 同时为了 import 这个样式字面量,
nsh-bundler会把整份 3700 多行的SessionSurface.tsx及其依赖打包一遍。
建议直接删掉
conversationStageStyle导出和这个假壳测试,在SessionSurface.tsx原地内联补一行flexDirection: 'column'(顺带修掉WorkspaceSurface)即可;若确实需要回归测试,建议基于真实渲染的SessionSurface断言,而不是测导出的样式对象。 - 该测试并没有挂载真实的
… synthetic style test Address review feedback on apache#7569: - Add flexDirection: 'column' to WorkspaceSurface in products/maka/workbench/app/App.tsx where display: props.visible() ? 'flex' : 'none' also triggered NSH's implicit FlexDirection::Row for multi-child surfaces. - Keep flexDirection: 'column' inline in SessionSurface.tsx and remove the exported conversationStageStyle helper and synthetic layout test in automations_tests.rs. Generated-by: Antigravity
|
Thanks for the thorough review, @M4n5ter! Both suggestions make total sense and have been applied:
The PR description has been updated accordingly. |
Summary
Fixes two NSH
display: 'flex'layout bugs where containers omittedflexDirection: 'column':In NSH (
third-party/nsh/crates/nsh-core/src/style.rs), explicitly settingdisplay: 'flex'without aflexDirectiondefaultsflex_directiontoFlexDirection::Row(CSS flex semantics), causing children to lay out side-by-side instead of stacking vertically.plugins/agent/conversations/ui/SessionSurface.tsx: AddflexDirection: 'column'to the conversation stage wrapper introduced in feat(workbench): redesign Automations workspace and scheduler controls #7563 (d5d8cf4b8), so<ComposerView>stays stacked below<Conversation>instead of being pushed horizontally to the top-right corner beside the window controls.products/maka/workbench/app/App.tsx: AddflexDirection: 'column'toWorkspaceSurface, fixing the same horizontal-row bug when it renders multiple siblings (the narrow-window!shell.sidebarDocked()All computersbar below<Workbench>, and the disconnected remote-root Rooms view with{modeSwitch()}above<MirrorBrowser />).Refs #7563
Verification
node node_modules/@biomejs/biome/bin/biome check plugins/agent/conversations/ui/SessionSurface.tsx products/maka/workbench/app/App.tsx— passed (0 issues).maka-desktop-shell.exe): conversation composer renders vertically at the bottom of the conversation pane instead of overlapping the top-right window controls.AI use
Select exactly one:
Tool(s) and scope: Antigravity — root-cause investigation, fixes in
SessionSurface.tsxandApp.tsx, and local verification.Checklist
Does this PR entail a breaking change or persisted-data migration?
upgrade_compat.rscoverage under Summary aboveDoes this PR entail a change in behavior?